package com.leyou.auth.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
public class OssConfig {


    @Bean
    public OSS ossClient(OssProperties pop){
//            return new OSSClient(pop.getEndpoint(),pop.getAccessKeyId(),pop.getAccessKeySecret());过时的方法
        return new OSSClientBuilder().build(pop.getEndpoint(),pop.getAccessKeyId(),pop.getAccessKeySecret());
    }

}
